import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/home.vue'
import Tabber from '../components/Tabbar/Tabbar.vue'

Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        name: 'Home',
        components: {
            default: Home,
            tabbar: Tabber,
        },
        meta: {
            keepAlive: true,
            showHeader:false
        }
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            title:"登录",
            showHeader:false,
        },
        components: {
            default:() => import('../views/login/login.vue'),
            tabbar:Tabber
        }
    },
    {
        path: '/register',
        name: 'register',
        meta: {
            title:"注册",
            showHeader:false,
        },
        components: {
            default: () => import('../views/login/register'),
            tabbar:Tabber
        }

    },
    {
        name: 'order',
        path: '/order',
        components: {
            default: ()=>import('../views/order/order.vue'),
            tabbar:Tabber
        }
    },
    {
        name:'user',
        path:'/user',
        components: {
            default:()=>import('../views/user/user.vue'),
            tabbar:Tabber
        }
    },
    {
        name:'address',
        path:'/user/address',
        components: {
            default:()=>import('../views/user/user-address/user-address.vue')
        }
    },
    {
        name:'item-detail',
        path:'/item/detail/:spuId',
        components:{
            default:()=>import('../views/items/detail/detail.vue')
        }
    },
    {
        name:'user-collect',
        path:'/user/collect',
        components:{
            default:()=>import('../views/user/user-collect/user-collect.vue')
        }
    },
    {
        name:'user-add-address',
        path:'/user/add/address',
        components:{
            default:()=>import('../views/user/user-address/user-add-address.vue')
        }
    },
    {
        name:'item-pmsSpu',
        path:'/spu/catalog3Id/:catalog3Id',
        components: {
            default:()=>import('../views/pmsProductInfo/pmsSpuList.vue')
        }
    },
    {
        name: 'post',
        path: '/post',
        components: {
            default:()=>import('../views/post/post.vue'),
            tabbar:Tabber
        }
    },
    {
        name: 'user-message',
        path: '/user/user-message',
        components: {
            default:()=>import('../views/user/user-edit/user-message'),
            tabbar:Tabber
        }
    },
    {
        name: 'post-details',
        path: '/post/post-details/:postId',
        components: {
            default:()=>import('../views/post/post-details'),
            tabbar:Tabber,
        }
    },
    {
        name: 'test',
        path: '/test',
        components: {
            default:()=>import('../views/post/static/test'),
        }
    },{
        name: 'shop',
        path: '/shop',
        components: {
            default:()=>import('../views/shop/shop'),
            tabbar:Tabber,

        }
    },
    {
        name: 'userHome',
        path: '/userHome/:userId',
        components: {
            default:()=>import('../views/user/userHome'),
            tabbar:Tabber,
        }
    },{
        name: 'goodsDetail',
        path: '/shop/goodsDetail/:goodsId',
        components: {
            default:()=>import('../views/shop/goodsDetail'),
        }
    },
    {
        name: 'OrderSubmit',
        path: '/shop/OrderSubmit/:goodsId',
        components: {
            default:()=>import('../views/shop/OrderSubmit'),

        }
    },{
        name: 'AddressManagement',
        path: '/shop/AddressManagement',
        components: {
            default:()=>import('../views/shop/AddressManagement'),

        }
    },{
        name: 'AddressEdit',
        path: '/shop/AddressEdit',
        components: {
            default:()=>import('../views/shop/AdressEdit'),

        }
    },{
        name: 'Resell',
        path: '/shop/Resell',
        components: {
            default:()=>import('../views/shop/Resell'),

        }
    },{
        name: 'OrderSpeed',
        path: '/shop/OrderSpeed',
        components: {
            default:()=>import('../views/shop/OrderSpeed'),

        }
    },{
        name: 'postEditor',
        path: '/postEditor',
        components: {
            default:()=>import('../views/post/postEditor'),

        }
    },{
        name: 'ResellOrderSpeed',
        path: '/ResellOrderSpeed',
        components: {
            default:()=>import('../views/shop/ResellOrderSpeed'),

        }
    },
    {
        name: 'userServer',
        path: '/user/server',
        components: {
            default:()=>import('../views/user/user-server/user-server'),

        }
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
